<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="../org/angular.min.js"></script>
    <script src="../org/jquery.min.js"></script>
</head>
<body>

<div ng-app="hd">
    <div ng-controller="ctrl">
        {{data}}<hr>
        <div ng-bind-html="data"></div><hr>
        <div ng-bind-html="title | trustHtml"></div>
    </div>

</div>
<script>
    var m = angular.module('hd', []);

    //可以使用过滤器进行统一处理
    m.filter('trustHtml', ['$sce', function ($sce) {
        return function (data) {
            return $sce.trustAsHtml(data);
        }
    }]);

    m.controller('ctrl', ['$scope', '$sce', function ($scope, $sce) {
        $scope.data = $sce.trustAsHtml('<h1 style="color:red;">houdunren.com</h1>'); //要显示html内容，需要使用$sce组件，并且使用ng-bind-html属性绑定显示

        $scope.title = '<h3 style="color:red;">houdunren.com</h3>';


    }]);
</script>
</body>

</html>